var that
var app = getApp();
const db = wx.cloud.database();
const _ =db.command;
Page({
  data: {
    consultants:{},
    topics:{}
  },
  onLoad: function (options) {
    that = this
    if (app.globalData.openid) {
      this.setData({
        openid: app.globalData.openid
      })
    }
    console.group('数据库"实时数据推送"文档')
    console.log('https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/realtime.html')
    console.groupEnd()

    db.collection('consultant').get({
      success : function(res){
        that.data.consultants = res.data
        that.setData({  
          consultants : that.data.consultants
        })
        console.log(that.data.consultants)
      }
    })
  },
  onItemClick: function(event) {
    var id = event.currentTarget.dataset.id;
    wx.navigateTo({
      url: "./order/order?id=" + id 
    })
  },
})